<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>固定定位</title>
    <style>
        .outer {
            width: 500px;
            background-color: skyblue;
            border: 1px black solid;
            padding: 20px;

        }

        .box {
            width: 200px;
            height: 200px;
            font-size: 20px;
        }

        .box1 {
            background-color: red;
        }

        .box2 {
            background-color: green;
            position: fixed;
            top: 0;
            left: 0;
        }

        .box3 {
            background-color: blue;

        }


    </style>
</head>
<body>
<hr>
<div class="outer">
    <div class="box box1">1</div>
    <div class="box box2">2</div>
    <div class="box box3">3</div>
</div>
<hr>
<img src="../../images/固定定位.png" width="450px">

</body>
</html>